import request from '@/utils/request'
// 获取角色列表
export const getRolesList = (params) => {
  return request.get('/roles', { params })
}

// 获取角色数量
export const getRolesCount = () => request.get('/roles/count')

// 获取指定角色
export const getRoles = (id) => request.get(`/roles/${id}`)

// 添加角色
export const addRoles = (data) => request.post(`/roles`, data)

// 编辑角色
export const editRoles = (data) => request.put(`/roles/${data.id}`, data)

// 删除角色
export const deleteRoles = (id) => request.delete(`/roles/${id}`)

// 确定分配权限
export const okRoles = (id, permissions) => request.put(`/roles/${id}`, {
  permissions
})
